#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "childwnd.h"
#include <QSignalMapper>
#include <QMainWindow>
#include <QMdiSubWindow>
#include <QFileDialog>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void initMainWindow();
    void docNew();
    void docOpen();
private slots:
    void on_newAction_triggered();
    void refreshMenus();
    void addSubWndListMenu();


    void on_closeAction_triggered();

    void on_closeAllAction_triggered();

    void on_titleAction_triggered();

    void on_cascadeAction_triggered();

    void on_nextAction_triggered();

    void on_previousAction_triggered();

    void setActiveSubWindow(QWidget* wnd);

    void on_openAction_triggered();

    void on_saveAction_triggered();

    void on_saveAsAction_triggered();

    void on_undoAction_triggered(); // 撤销
    void on_redoAction_triggered(); // 重做
    void on_cutAction_triggered();  // 剪切
    void on_copyAction_triggered(); // 复制

    void on_boldAction_triggered(); // 加粗
    void on_italicAction_triggered(); // 倾斜
    void on_underlineAction_triggered(); // 下划线
    void on_fontColorChanged(); // 字体颜色改变

    void on_leftAlignAction_triggered();    // 左对齐
    void on_centerAction_triggered();      // 居中
    void on_rightAlignAction_triggered();   // 右对齐
    void on_justifyAction_triggered();      // 两端对齐

protected:
    void closeEvent(QCloseEvent *event);
private:
    void formatEnabled();
    ChildWnd* activatechildWnd();
    QMdiSubWindow* findChildWnd(const QString& docName);

private:
    Ui::MainWindow *ui;
    QSignalMapper* m_WndMapper;
};

#endif // MAINWINDOW_H
